/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package AirLine;

/**
 *
 * @author Fredrik
 */
public class Seat implements Comparable {

    public static final int WINDOW_TYPE = 1;
    public static final int ISLE_TYPE = 2;
    public static final int ROW_TYPE = 3;
    private boolean booked = false;
    private String planeId;
    private int type;
    private int row,  column;

    public Seat(boolean booked, int type, String planeId, int row, int column) {
        this.booked = booked;
        this.type = type;
        this.planeId = planeId;
        this.row = row;
        this.column = column;
    }

    public String getPlaneid() {
        return planeId;
    }

    public int getRow() {
        return row;
    }

    public int getColumn() {
        return column;
    }

    public void setBooked(boolean booked) {
        this.booked = booked;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getType() {
        return type;
    }

    public boolean isBooked() {
        return booked;
    }

    public int compareTo(Object o) {
        if (o instanceof Seat) {
            return compareTo((Seat) o);
        } else {
            System.out.println("NJAAAA, INTE HIT!!!");

            return -1;
        }
    }

    public int compareTo(Seat s) {


        if (getPlaneid().equals(s.getPlaneid())) {
            if (getRow() == s.getRow()) {
                return getColumn() - s.getColumn();
            } else {
                return getRow() - s.getRow();
            }
        } else {
            return getPlaneid().compareTo(s.getPlaneid());
        }

    }
}
